import axios from 'axios'; 
import utils from "../utils/index"; 

// const axios = Axios.create();
// axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; 

// axios.cancel = {};
axios.interceptors.request.use((config) => {
    config.headers['token'] = utils.getCookie('token');
    if (config.method === 'post') { }
    if (config.method === 'get') { }
    return config;
});

axios.interceptors.response.use(
    (response) => {
        if (response.data.code == 401) { }
        return response;
    },
    (error) => { 
        return Promise.reject(error);
    }
);

axios.defaults.baseURL = process.env.VUE_APP_URL;
export default axios;